import 'package:enterprise_v6_app/app/components/custom_refresh.dart';
import 'package:enterprise_v6_app/app/core/core.dart';
import 'package:enterprise_v6_app/app/core/http/http.dart';
import 'package:enterprise_v6_app/app/core/utils/interface.dart';
import 'package:enterprise_v6_app/app/data/entities/double_control/get_risk_object_by_id_entity.dart';
import 'package:enterprise_v6_app/app/data/entities/task/base_risk_object_entity.dart';

///基本信息
class RiskControlApproveDetailInfoController extends GetxController {
  /// 列表刷新key
  final GlobalKey<CustomEasyRefreshListState> globalKey = GlobalKey();

  /// 筛选右侧栏控制Key
  final riskRightScaffoldKey = GlobalKey<ScaffoldState>();

  /// 上个界面的列表item对象
  BaseRiskObjectEntity item = Get.arguments as BaseRiskObjectEntity;
  GetRiskObjectByIdEntity? data;
  @override
  void onInit() {
    super.onInit();
    //获取指定的风险管控对象（含子节点树形）
    _getRiskObjectById();
  }

  void _getRiskObjectById() async {
    final res = await HttpUtil().generateGetRequest<GetRiskObjectByIdEntity>(
      Interface.getRiskObjectById,
      queryParameters: {'id': item.id},
    ).execute();
    res.onSuccess((result) {
      if (result.data != null) {
        data = result.data;
      }
    });
    update();
  }
}
